home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-11 / colorset.zip / COLORSET.DOC < prev    next >
Text File  |  1993-01-04  |  6KB  |  176 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.                                    COLORSET
  28.  
  29.                       A CLIPPER COLOR SELECTION ROUTINE
  30.  
  31.                                       by
  32.  
  33.                              MICHAEL K. BOZOVICH
  34.  
  35. ###############################################################################
  36.   I wrote this because I needed it.  Other people may also find it useful.
  37. If so, that is great.  Anybody is welcome to use or not use anything included
  38. in this ZIP file to his/her heart's content.  If you do NOT like it, erase it;
  39. don't gripe at me...
  40.  
  41.   The files in this ZIP should consist of:
  42.  
  43.  
  44.      INKEY.H             &&\
  45.      ACHOICE.H           && PreProcessor Header Files
  46.      COLORSET.H          &&/
  47.  
  48.      COLORSET.           && Microsoft MAKE response file
  49.      COLORSET.PRE        && The Pre-PreProcessed Source (Nicely Formatted)
  50.      COLORSET.PRG        && The PreProcessed Source (Could be ugly...)
  51.      COLORSET.EXE        && The DEMO Executable
  52.      COLORSET.DOC        && Take a wild guess...
  53.  
  54.   You MUST have a copy of the IDL function library to link this code.  If
  55. you are unfortunate enough to NOT have a copy, one may be obtained from:
  56.  
  57.   Integrated Development Corporation
  58.   (603)382-1313
  59.  
  60.   The program creates two memory files if they are not found in the current
  61. directory at run time.  They are:
  62.  
  63.      COLORS.MEM          && Contains the color string variables.
  64.  
  65.      ATTRIB.MEM          && Contains the screen memvar for the
  66.                          &&  'attribute rectangle'.
  67.  
  68.   The source is generously commented (by my standards, anyway), and should
  69. be pretty much self-documenting.  It demonstrates the power of the IDL
  70. attribute functions nicely.  It also demonstrates some uses for a preprocessor.
  71.  
  72. ###############################################################################
  73.  
  74. There are 4 major procedures where all the action takes place.
  75.  
  76.   COLORSET:
  77.  
  78.     Sets up initial variables and environment, draws the main part of the
  79.     screen, and calls ACHOICE().  The routine that draws the rectangle
  80.     of all possible colors is mildly interesting.  If you can improve upon
  81.     it's EXECUTION SPEED, please let me know.  That's pretty much it.
  82.  
  83.   SHOWSTAT():
  84.  
  85.     This is the function called repeatedly by ACHOICE().  It is responsible
  86.     for the 'real-time' color updating in the sample window.  It is also
  87.     where the COLORSEL routine is called when the user presses <Enter>.
  88.     After COLORSEL is called, the appropriate color string(s) is/are updated.
  89.     Interesting points here include the method of keeping the menu hilite
  90.     turned on while in this function and the kludge used to allow the hilite
  91.     to wrap like 'MENU TO'.
  92.  
  93.   COLORSEL:
  94.  
  95.     This procedure does some string/numeric conversions and sets up a 'dummy'
  96.     wait state so we can call a hot key procedure assigned to all four arrow
  97.     keys.  Some hand stands are performed to keep the GET from showing up
  98.     on the screen, what with the colors changing all the time and all, but
  99.     it works.
  100.  
  101.   NAVIGATE:
  102.  
  103.     This is the hot key procedure called from the dummy wait state.
  104.     It moves the arrow pointers around while updating the sample window and
  105.     updating the numeric attribute variables.
  106.  
  107. ###############################################################################
  108.  
  109. The colors I keep track of in most large systems I write and their respective
  110. variables are outlined below:
  111.  
  112.   Normal Text - c_scr_color
  113.  
  114.     This is the normal foreground and background colors used by 99% of the
  115.     code.  Both 'Standard' and 'Enhanced' portions of the string are tracked.
  116.     The 'Standard' portion of this string is forced to be the 'Enhanced'
  117.     portion of the 'Inverse Video' string (and vice versa).  See the source
  118.     for details of this restriction.
  119.  
  120.   High Intensity - c_int_color
  121.  
  122.     I use this for screen titles and other important messages that I do not
  123.     want to go unnoticed.  The background portion of the string is forced to
  124.     be the same as that of 'Normal Text'.  Only the 'Standard' portion is used.
  125.  
  126.   Inverse Video - c_inv_color
  127.  
  128.     I use this for pop-up pick lists and windows.  It is nice to have a true
  129.     inverse of the normal text string.  This string depends on the Normal
  130.     Text variable (and vice versa).  (See 'Normal Text')
  131.  
  132.   Status Messages - c_msg_color
  133.  
  134.     This color is used for harmless status messages like 'Indexing',
  135.     'Printing', 'Loading', etc....  Only the 'Standard' portion is used.
  136.  
  137.   Error Messages - c_err_color
  138.  
  139.     Just what you would imagine...
  140.  
  141.   Help Screens - c_hlp_color
  142.  
  143.     Also self-explanatory.
  144.  
  145. These color string variables use the Clipper NUMERIC convention for colors
  146. instead of the string convention because it is MUCH easier to code;  esp.
  147. since the IDL functions expect an <expN> as argument(s).  It is a hell of a
  148. lot easier to convert "7/0" to 7 than it is to convert "g/rb" (Yecch!) to 82.
  149.  
  150. The restrictions (if any) placed on each variable are enforced by the code.
  151. Note that the code totally disallows the combinations where text would be
  152. invisible...
  153.  
  154. ###############################################################################
  155.  
  156.      A possible modification to this code would be to make the menu a "MENU
  157. TO" vs. the current ACHOICE().  This would keep you from 'real-time'
  158. updating the sample window while the bounce bar moves, but would simplify the
  159. code and reduce memory requirements.
  160.  
  161.     Other (needed) modifications:
  162.  
  163.       -- A coherent method of adding a 'blink' to appropriate variables.
  164.  
  165.       -- Stripping out the STRZERO() from EXAMPLEP in EXTEND.  (I did this
  166.          with MY extend, but in the interest of compatibility, I left it
  167.          in here.)
  168.  
  169. Contact me at:
  170.  
  171.                          The Alton Penguin
  172.                          300/1200/2400 N81
  173.                          Evenings after 1800 CST/Weekends
  174.                          (618)463-0427
  175.  
  176.